import _this from '@/main.js'

export function toMxStatus(item) {
  switch (item.fstatus) {
    case 0:
      item.fstatus = '未入库'
      break
    case 1:
      item.fstatus = '入库'
      break
    case 2:
      item.fstatus = '出库'
      break
    case 3:
      item.fstatus = '删除'
      break
    default:
      item.fstatus = ''
  }
}
export function toMxAmina(item) {
  switch (item.fdocumentStatus) {
    case 'A':
      item.fdocumentStatus = _this.$t('market.create') // 创建
      item.stateColor = 'primary'
      break
    case 'B':
      item.fdocumentStatus = _this.$t('market.state1') // 审核中
      item.stateColor = 'primary'
      break
    case 'C':
      item.fdocumentStatus = _this.$t('market.state2') // 已审核
      item.stateColor = 'success'
      break
    case 'D':
      item.fdocumentStatus = _this.$t('market.state3') // 重新审核
      item.stateColor = 'danger'
      break
    case 'E':
      item.fdocumentStatus = _this.$t('market.state4') // 暂存
      item.stateColor = 'primary'
      break
    case 'F':
      item.fdocumentStatus = _this.$t('market.state7')
      item.stateColor = 'warning'
      break
    default:
      item.fdocumentStatus = ''
  }
  return item
}
// 领料状态
export function toPickStues(item) {
  switch (item.fpickstatus) {
    case 1:
      item.fpickstatus = _this.$t('market.pickingPart') // 部分领料
      item.pickColor = 'primary'
      break
    case 2:
      item.fpickstatus = _this.$t('market.pickingAll') // 全部领料
      item.pickColor = 'success'
      break
    case 3:
      item.fpickstatus = _this.$t('market.pickingSur') // 超额领料
      item.pickColor = 'warning'
      break
    case 0:
      item.fpickstatus = _this.$t('market.pickingNot') // 未领料
      item.pickColor = 'danger'
      break
    default:
      item.fpickstatus = ''
  }
  return item
}
export function moSubToMxAmina(item) {
  switch (item.moSubFdocumentStatus) {
    case 'A':
      item.moSubFdocumentStatus = _this.$t('market.create')
      item.stateColors = 'primary'
      break
    case 'B':
      item.moSubFdocumentStatus = _this.$t('market.state1')
      item.stateColors = 'primary'
      break
    case 'C':
      item.moSubFdocumentStatus = _this.$t('market.state2')
      item.stateColors = 'success'
      break
    case 'D':
      item.moSubFdocumentStatus = _this.$t('market.state3')
      item.stateColors = 'danger'
      break
    case 'E':
      item.moSubFdocumentStatus = _this.$t('market.state4')
      item.stateColors = 'primary'
      break
    case 'F':
      item.moSubFdocumentStatus = _this.$t('market.state7')
      item.stateColors = 'warning'
      break
  }
  return item
}
export function toMxBmina(item) {
  switch (item.fdocumentstatus) {
    case 'A':
      item.fdocumentstatus = _this.$t('market.create')
      item.stateColor = 'primary'
      break
    case 'B':
      item.fdocumentstatus = _this.$t('market.state1')
      item.stateColor = 'primary'
      break
    case 'C':
      item.fdocumentstatus = _this.$t('market.state2')
      item.stateColor = 'success'
      break
    case 'D':
      item.fdocumentstatus = _this.$t('market.state3')
      item.stateColor = 'danger'
      break
    case 'E':
      item.fdocumentstatus = _this.$t('market.state4')
      item.stateColor = 'primary'
      break
    case 'F':
      item.fdocumentstatus = _this.$t('market.state7')
      item.stateColor = 'warning'
      break
    case 'G':
      item.fdocumentstatus = _this.$t('market.consentNo')
      item.stateColor = 'danger'
      break
    default:
      item.fdocumentstatus = ''
  }
  return item
}
export function toDocument(item) {
  switch (item.FDOCUMENTSTATUS) {
    case 'A':
      item.FDOCUMENTSTATUS = _this.$t('market.create')
      item.stateColor = 'primary'
      break
    case 'B':
      item.FDOCUMENTSTATUS = _this.$t('market.state1')
      item.stateColor = 'primary'
      break
    case 'C':
      item.FDOCUMENTSTATUS = _this.$t('market.state2')
      item.stateColor = 'success'
      break
    case 'D':
      item.FDOCUMENTSTATUS = _this.$t('market.state3')
      item.stateColor = 'danger'
      break
    case 'E':
      item.FDOCUMENTSTATUS = _this.$t('market.state4')
      item.stateColor = 'primary'
      break
  }
  return item
}

export function Disable(item) {
  switch (item.fforbidStatus) {
    case 'A':
      item.fforbidStatus = _this.$t('market.no')
      break
    case 'B':
      item.fforbidStatus = _this.$t('market.yes')
      break
    default:
      item.fforbidStatus = _this.$t('market.no')
  }
  return item
}
export function Forbid(item) {
  switch (item.FFORBIDSTATUS) {
    case 'A':
      item.FFORBIDSTATUS = _this.$t('market.no')
      break
    case 'B':
      item.FFORBIDSTATUS = _this.$t('market.yes')
      break
    default:
      item.FFORBIDSTATUS = _this.$t('market.no')
  }
  return item
}
export function CloseId(item) {
  switch (item.fclosestatus) {
    case 'A':
      item.fclosestatus = _this.$t('market.normal')
      item.closeColor = 'primary'
      break
    case 'B':
      item.fclosestatus = _this.$t('btn.closed')
      item.closeColor = 'danger'
      break
    default:
      item.fclosestatus = ''
  }
  return item
}
export function shut(item) {
  switch (item.fcloseStatus) {
    case 'A':
      item.fcloseStatus = _this.$t('market.normal')
      item.closeColor = 'primary'
      break
    case 'B':
      item.fcloseStatus = _this.$t('btn.closed')
      item.closeColor = 'danger'
      break
    default:
      item.fcloseStatus = ''
  }
  return item
}
export function Forbiders(item) {
  switch (item.FFORBIDSTATUS) {
    case 'A':
      item.FFORBIDSTATUS = _this.$t('market.no')
      break
    case 'B':
      item.FFORBIDSTATUS = _this.$t('market.yes')
      break
    default:
      item.FFORBIDSTATUS = _this.$t('market.no')
  }
  return item
}

export function userDisable(item) {
  switch (item.ISDISABLE) {
    case 0:
      item.ISDISABLE = _this.$t('market.no')
      break
    case 1:
      item.ISDISABLE = _this.$t('market.yes')
      break
    default:
      item.ISDISABLE = _this.$t('market.no')
  }
  return item
}
export function notoMxAmina(item) {
  switch (item.fdocumentStatus) {
    case _this.$t('market.create'):
      item.fdocumentStatus = 'A'
      break
    case _this.$t('market.state1'):
      item.fdocumentStatus = 'B'
      break
    case _this.$t('market.state2'):
      item.fdocumentStatus = 'C'
      break
    case _this.$t('market.state3'):
      item.fdocumentStatus = 'D'
      break
    case _this.$t('market.state4'):
      item.fdocumentStatus = 'E'
      break
    case _this.$t('market.state7'):
      item.fdocumentStatus = 'F'
      break
    default:
      item.fdocumentStatus = 'A'
  }
  return item
}
export function notoMxBmina(item) {
  switch (item.fdocumentstatus) {
    case _this.$t('market.create'):
      item.fdocumentstatus = 'A'
      break
    case _this.$t('market.state1'):
      item.fdocumentstatus = 'B'
      break
    case _this.$t('market.state2'):
      item.fdocumentstatus = 'C'
      break
    case _this.$t('market.state3'):
      item.fdocumentstatus = 'D'
      break
    case _this.$t('market.state4'):
      item.fdocumentstatus = 'E'
      break
    case _this.$t('market.state7'):
      item.fdocumentstatus = 'F'
      break
    default:
      item.fdocumentstatus = 'A'
  }
  return item
}
